<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
{{assign var="title" value='相册'}}
{{assign var="app" value='photo'}}
{{assign var="act" value='index'}}
{{assign var="table" value='photo'}}
{{assign var="uploadPlug" value='plupload'}}
{{assign var="td" value='6'}}
<title>{{$title}}管理 - {{'admin|admin_site_name'|C|default:'后台管理'}}</title>
{{include file="include/base.html"}}
{{include file="{{$smarty.const.PLUG}}115box/115box.html"}}
{{include file="{{$smarty.const.PLUG}}lazyload/lazyload.html"}}
{{include file="{{$smarty.const.PLUG}}drag/drag.html"}}
{{include file="{{$smarty.const.PLUG}}chosen/chosen.html"}}
{{include file="{{$smarty.const.PLUG}}editable/editable.html"}}
</head>
<body>

{{include file="include/sidebar.html"}}

	<div class="body_right">
	<div id="content">
	
	<div class="search">
	<form action="index.php?app={{$app}}" name="search" class="router" method="get">
		<input type="hidden" name="app" value="{{$app}}"/>
		<input type="hidden" name="cat" value="{{$smarty.get.cat}}"/>
		<input type="hidden" name="url" value="{{$smarty.get.url}}"/>
		  <ul class="bread">
			<li> <a href="{{$smarty.get.url|decode|default:'javascript:history.go(-1)'}}" class="btn"><i class="icon-chevron-left"></i>返回{{$title}}</a> </li>
			<li>图片名称：</li>
			<li><input type="text" name="title" maxlength="50" style="width: 80px;" value="{{$smarty.get.title}}">　</li>
			<li>
				<select name="publish" class="chosen">
					<option value="">全部...</option>
					{{html_options options=$publish selected=$smarty.get.publish}}
				</select>
			</li>
			<li>
				<button type="submit" class="search btn btn-success"><i class="icon-search"></i>搜索</button>
				<a href="index.php?app={{$app}}&act={{$act}}&cat={{$smarty.get.cat}}&url={{$smarty.get.url}}" class="a">清除</a>
			</li>
		  </ul>
	</form>
	</div>
	
	
	<input type="checkbox" class="check_all_img" style="display:none;" value="" class="np">
	<form method='post' id='form' name="form" action="index.php?app={{$app}}">
		<input type="hidden" name="act" value="{{$act}}"/>
		<input type="hidden" name="app" value="{{$app}}"/>
		<input type="hidden" name="sql" value="{{$sql}}"/>
		<input type="hidden" name="table" value="photo"/>
		<dl class="dbox drags saveorder" date="{{'table=photo&field=ordering'|encode}}">
			<dt class="lside">
				<div class="floatr">
					<a class="btn iframe fontwn" width="650px" height="320px" title="上传相片" href="index.php?app={{$app}}&act={{$uploadPlug}}&item={{$smarty.get.item}}"><i class="icon-upload-alt"></i>上传相片</a>
					<a link="index.php?app=photo&act=clear&item={{$smarty.get.item}}" class="btn more ajaxSubmit btn-warning fontwn" title="清理相册中不存在的图片"><i class="icon-trash icon-white"></i>清理</a>
					<button class="mydelete btn btn-danger" type="submit"><i class="icon-trash icon-white"></i>删除</button>
				</div>
				◆ 图片浏览
			</dt>
			<dd style="padding:0;">
				<div id="quickmenu" style="overflow:visible;">
					{{if !$result}}{{*是否有显示结果 S*}}
					<div class="result_empty"></div>
					{{else}}
					<div class="listthumb">
					<ul>
					{{foreach from=$result item=val}}
						<li class="drag">
							<div class="checkbox">
								<input class="check_id" type="checkbox" style="display:none;" value="{{$val.id}}" name="check_id[]">
								<input class="ids" type="hidden" value="{{$val.id}}" name="ids[]">
							</div>
							<div class="file-thumb photo-box">
								<div class="boxout">
									<div class="boxin">
										<a class="zoom" title='{{$val.title}}' href="{{$smarty.const.__PUB__}}{{$val.link}}">
											<img class="lazyload" style="display:block;margin:0 auto;min-width:35px;min-height:35px;" data-original='{{$val.thumbs_link|photo:340:255:true}}'/>
										</a>
									</div>
								</div>
								<a href="javascript:" class="star" >星标</a>
								<a class="star {{if $val.publish==1}}publish{{/if}}" href="index.php?app=functions&act=setValue&value={{!$val.publish}}&params={{'table='|cat:$table|cat:'&field=publish&id='|cat:$val.id|encode}}">星标</a>
							</div>
							<div class="file-name"> 
								<a href="javascript:" class="editable" data="{{'table='|cat:$table|cat:'&field=title&id='|cat:$val.id|encode}}" title="{{$val.title|default:"暂无描述"}}">{{$val.title|default:"暂无描述"}}</a>
							</div>
							<div class="file-info">{{$val.params.unit}}<br><span style="color:#555;font-size:11px;">({{$val.params.width}} x {{$val.params.height}})</span></div>
							<div class="file-opt">
								<a href="index.php?app=photo&act=modify&id={{$val.id}}&iframe=true" width="600" height="220" class="iframe" title="编辑"><i class="icon-edit"></i></a>
								<a class="i-delete refresh ajaxSubmit confirm" title="删除将不可恢复,确定要删除吗?" link="index.php?app=photo&act=delete&id={{$val.id}}"><i class="icon-trash"></i></a>
							</div>
						</li>
					{{/foreach}}
					</ul>
					<div class="clear"></div>
					</div>
					<div style="margin-top:15px;padding-top:8px;border:1px solid #D6D6D6;height:40px;line-height:35px;">
						<a class="check_all_img btn floatl marginl20"><i class="icon-ok"></i>全选/反选</a>
						{{include file="include/page.html"}}
					</div>
					{{/if}}{{*是否有显示结果 E*}}
				</div>
				{{if $result|@count>0}}{{*没有显示结果时*}}
				{{/if}}
			</dd>
		</dl>
	</form>
</div>
</div>

<script>
$(document).ready(function(){
	$('a.check_all_img').click(function(){//全选时
		if($('input.check_all_img').attr('checked')){//if 全选input选中时
			//alert(66);
			$(".listthumb ul li").removeClass('focus');
			$('input.ids').attr('checked',false);
			$('input.check_all_img').attr('checked',false);
			box115focus('.listthumb .checkbox',false);
		}else{//当前状态:非全选
			$(".listthumb ul li").addClass('focus');//focus
			$('input.ids').attr('checked',true);//全选
			$('input.check_all_img').attr('checked',true);//标识:勾选
			box115focus('.listthumb .checkbox',true);
		}
	});
});

//box自适应间距
$(document).ready(function(){
	$(window).resize(function(){
		resize();
	});
});
resize();
function resize(){
	var box_factor = 129;//一个box宽度
	var big_box_width = $('.listthumb').width();//容器大box总宽度
	box_num = parseInt(big_box_width/box_factor);//计算一行可容纳的box数
	box_margin = parseInt((big_box_width-box_num*box_factor)/box_num/2);//计算小box的margin值
	$('.listthumb ul li').css('margin','10px '+parseInt(box_margin+2)+'px');
	//console.log('大宽度:'+big_box_width+' 可容纳数:'+box_num+' 算得边距:'+box_margin);
}
</script>

</body>
</html>